package com.ly.aidlpratice.handwritten

import android.os.IBinder
import android.os.IInterface
import com.ly.aidlpratice.bean.Book

const val BOOK_INTERFACE_TOKEN = "com.ly.aidlpratice.handwritten.IBookInterface"
const val TRANSACTION_GET_BOOK = IBinder.FIRST_CALL_TRANSACTION
const val TRANSACTION_GET_ALL_BOOK = IBinder.FIRST_CALL_TRANSACTION + 1
const val TRANSACTION_IS_CONTAIN_BOOK = IBinder.FIRST_CALL_TRANSACTION + 2
const val TRANSACTION_UPDATE_BOOK_PRICE = IBinder.FIRST_CALL_TRANSACTION + 3
const val TRANSACTION_GET_BOOK_PRICE = IBinder.FIRST_CALL_TRANSACTION + 4
const val TRANSACTION_INSERT_BOOK = IBinder.FIRST_CALL_TRANSACTION + 5
const val TRANSACTION_INSERT_BOOK_LIST = IBinder.FIRST_CALL_TRANSACTION + 6
const val TRANSACTION_GET_BOOK_MAP = IBinder.FIRST_CALL_TRANSACTION + 7
const val TRANSACTION_INSERT_BOOK_MAP = IBinder.FIRST_CALL_TRANSACTION + 8
const val TRANSACTION_REGISTER_CALLBACK = IBinder.FIRST_CALL_TRANSACTION + 9
const val TRANSACTION_UNREGISTER_CALLBACK = IBinder.FIRST_CALL_TRANSACTION + 10

interface IBookInterface : IInterface {
    fun getBook(): Book
    fun getAllBook(): List<Book>
    fun isContainBook(name: String): Boolean
    fun updateBookPrice(code: Int, price: Float)
    fun getBookPrice(code: Int): Float
    fun insertBook(book: Book)
    fun insertBookList(list: List<Book>)

    //不支持泛型 Map
    fun getBookMap(): Map<*, *>
    fun insertBookMap(map: Map<*, *>)
    fun registerCallback(callback: IBookCallback)
    fun unregisterCallback(callback: IBookCallback)
}